home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
boot
/
czesc_2
/
snap
/
patch.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-04
|
724b
|
41 lines
#ifdef LATTICE
typedef ULONG(*FPTR) ();
#endif
#ifdef AZTEC_C
typedef VOID(*FPTR) ();
#endif
IMPORT struct IntuitionBase *IntuitionBase;
#define LVOActivateWindow -0x01c2L
VOID __stdargs __saveds myActivateWindow( void);
LONG oldActivateWindow;
STATIC WORD patched = 0;
VOID SafePatch( void)
{
if (!patched)
{
Forbid(); /* I don't expect interrupts to do much intuition */
oldActivateWindow = (LONG) SetFunction((struct Library *)IntuitionBase, LVOActivateWindow, (FPTR) myActivateWindow);
Permit();
patched = 1;
}
}
VOID SafeRestore( void)
{
if (patched)
{
Forbid();
(VOID) SetFunction((struct Library *)IntuitionBase, LVOActivateWindow, (FPTR) oldActivateWindow);
Permit();
patched = 0;
}
}